/**
 *	QuebraLink - Quebrador de links que tem protetor
 *  Copyright (C) 2011  Ranis <ranishot@gmail.com>
 * 
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *
 *  Classe Painel
 *
 *	Esta classe usa um gerenciador de layout mais flexivel
 *      baseado no GridBagLayout
 *
 *	@package QuebraLink
 *	@name QuebraLink.java
 *	@author	Ranishot <ranishot@gmail.com>
 *	@copyright (C)2010 - 2011 Ranishot.
 *	@contributors Rodrigo Borges <rodrigo@rbmsoft.com.br>
 *	@license GNU GPL v3
 *	@version 3.5
 *	@since 14/06/2011
*/
package quebralink;

import java.awt.Color;
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.BorderFactory;
import javax.swing.JPanel;

class PainelGBL extends JPanel {

    // Definição do Layout e constraints do Layout  
    private GridBagLayout layout;
    private GridBagConstraints constraints;
    public final int horizontal = GridBagConstraints.HORIZONTAL;
    public final int both = GridBagConstraints.BOTH;

    //Construtor do objeto (como o mesmo nome da classe)  
    public PainelGBL(int top,int left, int bottom, int right) {
        layout = new GridBagLayout();
        setLayout(layout);
        constraints = new GridBagConstraints();
        constraints.weightx = 0;
        constraints.weighty = 0;
        constraints.insets = new Insets(top, left, bottom, right);
    }

    // Método que posiciona o componente no Frame  
    public void addComponent(Component comp, int row, int column, int altura, int largura, int fill) {
        constraints.fill = fill;
        constraints.gridx = column;
        constraints.gridy = row;
        constraints.gridwidth = largura;
        constraints.gridheight = altura;
        layout.setConstraints(comp, constraints);
        add(comp);
    }

    // Método que define a borda do Frame  
    public void setBorda(Color color, int thickness) {
        setBorder(BorderFactory.createLineBorder(color, thickness));
    }
}
